home *** CD-ROM | disk | FTP | other *** search
/ Language/OS - Multiplatform Resource Library / LANGUAGE OS.iso / cpp_libs / answrbok / 4_6.lha / 4_6 / timen.c < prev    next >
Text File  |  1993-08-08  |  624b  |  28 lines

  1. * Copyright (c) 1990 by AT&T Bell Telephone Laboratories, Incorporated. */
  2. * The C++ Answer Book */
  3. * Tony Hansen */
  4. * All rights reserved. */
  5. include <stream.h>
  6. include <sys/types.h>
  7. include <sys/times.h>
  8.  
  9. truct tms sv_time0, sv_time1;
  10.  
  11. oid time0()
  12.  
  13.    (void) times(&sv_time0);
  14.  
  15.  
  16. xtern int printing;
  17.  
  18. oid time1(char *place)
  19.  
  20.    (void) times(&sv_time1);
  21.    if (printing & 2)
  22. cout << place << " at: usr=" << sv_time1.tms_utime - sv_time0.tms_utime <<
  23.     ",\tsys=" << sv_time1.tms_stime - sv_time0.tms_stime <<
  24.     "\ttot=" << sv_time1.tms_stime - sv_time0.tms_stime +
  25.         sv_time1.tms_utime - sv_time0.tms_utime <<
  26.     "\n";
  27.  
  28.